﻿using System;
using System.Collections.Generic;
using System.Configuration.Provider;
using System.Text;

namespace Rarous.TexyNet.Providers {
  /// <summary>
  /// Texy provider collection
  /// </summary>
  public class TexyProviderCollection : ProviderCollection {
    /// <summary>
    /// Add
    /// </summary>
    /// <param name="provider">Provider</param>
    public override void Add(ProviderBase provider) {
      if (provider == null) {
        throw new ArgumentNullException("The provider parameter cannot be null.");
      }

      if (!(provider is TexyProvider)) {
        throw new ArgumentException("The provider parameter must be of type TexyProvider.");
      }

      base.Add(provider);
    }

    /// <summary>
    /// Item
    /// </summary>
    /// <param name="name">Name</param>
    /// <returns>Texy provider</returns>
    new public TexyProvider this[string name] {
      get { 
        return base[name] as TexyProvider; 
      }
    }

    /// <summary>
    /// Copy to
    /// </summary>
    /// <param name="array">Array</param>
    /// <param name="index">Index</param>
    public void CopyTo(TexyProvider[] array, int index) {
      base.CopyTo(array, index);
    }
  }
}
